package com.action;

import com.bean.Users;
import com.service.LoginService;

public class LoginAction extends BasicAction {
	
	private LoginService loginService;
	private Users user;
//	 private List users;

	public String execute() {
		user = loginService.findUser(user.getUsername(), user.getPassword());
		if (user != null) {
			session.put("user", user);
//			 users = loginService.findAll();
//			 if(users.size()>0)
			return SUCCESS;
		}
		request.setAttribute("msg", "用户名或密码错误!");
		return LOGIN;
	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}

	public Users getUser() {
		return user;
	}

	public void setUser(Users user) {
		this.user = user;
	}
	
	
}
